package com.hoshiicloud.common.exception;

/**
 * @author: Markerccc
 * @date: 2019/7/16 - 16:53
 */
public class QueryException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    /**
     * 错误
     */
    private CommonError error;

    public QueryException(CommonError error) {
        super(error.getMsg());
        this.error = error;
    }

    public QueryException(String errorMsg) {
        super(errorMsg);
        this.error = CommonError.error(errorMsg);
    }

    public QueryException(CommonError error, Throwable cause) {
        super(error.getMsg(), cause);
        this.error = error;
    }


    /**
     * 获取错误
     *
     * @return 错误
     */
    public CommonError getError() {
        return error;
    }
}
